package com.qf.mapper;

import com.qf.entity.Menu;
import com.qf.entity.Role;
import com.qf.entity.User;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;
import java.util.Map;

public interface UserMapper extends Mapper<User> {

    @Select("select * from user where username=#{username}")
    User findUserByUsername(@Param("username") String username);

    /**
     *查询用户所对应的角色
     * @param userId
     * @return
     */
    Role findRoleByUserId(Integer userId);

    /**
     * 根据角色id查询菜单信息
     * @param roleId
     * @return
     */
    List<Menu> findMenuByRoleId(Integer roleId);



    //查询所有员工
    List<User> findAllUsers(Map map);

    //禁用员工
    int setUserStaus(@Param("userId")Integer userId);
    //启用
    int setUserStausActive(@Param("userId")Integer userId);

    //添加员工
    int addUser(User user);

    //修改员工信息前预览
    User preUpdate(@Param("userId") Integer userId);

    //修改员工
    int updateUser(User user);

    //假的删除
    int deleteUserEmpById(@Param("userId") Integer userId);

    //批量删除
    void deleteUserEmpMany(@Param("list") List<Integer> list);

    //excle
    List<User> getExcle(@Param("list") List<Integer> list);

    Integer ajaxUserId(@Param("username") String username);

    List<String> findUserNameByRoleId(@Param("roleId") Integer roleId);
}
